﻿CREATE PROCEDURE [dbo].[usp_UserApplication_Ins]
@NTUserName VARCHAR (50), @ApplicationName VARCHAR (256)
AS
BEGIN

DECLARE @ErrorCode AS INT
DECLARE @RowsAffected AS INT

INSERT INTO [UserApplication] WITH (ROWLOCK) ([NTUserName], [ApplicationName])
    VALUES (@NTUserName, @ApplicationName)

SELECT @ErrorCode = @@ERROR, @RowsAffected = @@ROWCOUNT

SELECT [ID], [NTUserName], [ApplicationName], [TimeStmp], [CreateDt], [CreateUid], [RevMdlName], [RevDt], [RevUid] FROM [UserApplication]
    WHERE ([ID] = SCOPE_IDENTITY())

RETURN @ErrorCode

END

